package com.practice.java8.stream;

import java.io.BufferedReader;
import java.io.StringReader;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;

public class FilterMain {

	public static void main(String[] args) {
		filterNumber();
		filterString();
	}
	
	public static void filterNumber() {
		Integer[] sixNums = {1, 2, 3, 4, 5, 6};
		Integer[] evens =
		Stream.of(sixNums).filter(n -> n%2 == 0).toArray(Integer[]::new);
	}
	
	public static void  filterString() {
		BufferedReader reader = new BufferedReader(new StringReader(""));
		List<String> output = reader.lines().
				 flatMap(line -> Stream.of(line.split(" "))).
				 filter(word -> word.length() > 0).
				 collect(Collectors.toList());
	}

}
